In [22]:
%matplotlib nbagg
In [23]:
from iuvs import io
In [2]:
df = pd.read_hdf('/home/klay6683/to_keep/l1a_dark_scan.h5', 'df')
# df = pd.read_hdf('/Users/klay6683/data/iuvs/l1a_dark_scan.h5', 'df')
In [3]:
from iuvs import meta
In [4]:
df = meta.clean_up_dark_scan(df)
In [5]:
def check_values(col):
return df[col.upper()].value_counts(dropna=False)
In [6]:
df = df[df.COLLECTION_ID!='cruise']
df = df[df.COLLECTION_ID!='transition']
df = df[df.INT_TIME.isin([14400, 4200, 1400])]
In [7]:
timeres = '5s'
In [8]:
hk = pd.read_hdf('/home/klay6683/to_keep/HK_DB.h5')
In [10]:
hk2015 = hk['2015']
In [12]:
hk2015 = hk2015.filter(regex='DET_TEMP_C')
In [13]:
hk2015.info()
In [21]:
hk2015.iloc[:10].resample(timeres)
Out[21]:
In [9]:
hktemps = hk['2015'].filter(regex='DET_TEMP_C').resample(timeres, how='ffill').dropna(how='all')
In [ ]:
g = df.groupby(['CHANNEL', 'INT_TIME', 'activity', 'BINNING_SET'])
In [ ]:
list_g = list(g)
In [ ]:
list_g[0][1]
In [ ]:
testdf = list_g[0][1].resample(timeres)
In [ ]:
hktemps['2015-01-04 14:35']
In [55]:
for name, group in g:
print(name, "Size:", len(group))
In [ ]:
In [44]:
muv1min = df[df.CHANNEL=='MUV'].resample('5s').dropna(how='all')
fuv1min = df[df.CHANNEL=='FUV'].resample('5s').dropna(how='all')
In [45]:
muv1min['HK_MUV_TEMP'] = hktemps.MUV_DET_TEMP_C
fuv1min['HK_FUV_TEMP'] = hktemps.FUV_DET_TEMP_C
In [57]:
for item in [muv1min, fuv1min]:
item.loc[item['INT_TIME']<1.4, 'INT_TIME'] = 1.4
In [21]:
import seaborn as sns
In [22]:
sns.set_style('whitegrid')
sns.set_context('talk')
In [54]:
df.INT_TIME.value_counts()
Out[54]:
In [87]:
g = sns.FacetGrid(muv1min, col='INT_TIME', size=4)
g.map(plt.scatter, 'DET_TEMP', 'mean')
Out[87]:
In [88]:
g = sns.FacetGrid(muv1min, col='INT_TIME', size=4, ylim=(0,1))
g.map(plt.scatter, 'DET_TEMP', 'mean')
Out[88]:
In [91]:
g = sns.FacetGrid(muv1min, col='INT_TIME', size=4, ylim=(0,1))
g.map(plt.scatter, 'HK_MUV_TEMP', 'mean')
Out[91]:
In [94]:
g = sns.FacetGrid(muv1min, col='BINNING_SET', col_wrap=3 )
g.map(plt.scatter, 'HK_MUV_TEMP', 'mean')
In [ ]:
g = sns.FacetGrid(df, col='CHANNEL')
g.map(plt.scatter, )
In [93]:
g?
In [ ]:
In [ ]:
In [ ]:
plt.figure()
sns.boxplot(x='COLLECTION_ID', y='mean', hue='CHANNEL', data=df)
In [ ]:
plt.figure()
sns.violinplot(x='COLLECTION_ID', y='median', hue='CHANNEL', data=df,
split=True, cut=0)
In [ ]:
plt.figure()
sns.violinplot(x='COLLECTION_ID', y='median', data=df, hue='CHANNEL', inner=None,
bw=.1, scale='count', scale_hue=False, cut=0)
sns.stripplot(x='COLLECTION_ID', y='median', data=df, jitter=True, size=3)
In [ ]:
plt.figure()
sns.barplot(x='COLLECTION_ID', y='mean', hue='CHANNEL', data=df)
In [ ]:
df = df[df.INT_TIME.isin([1.4, 4.2, 14.4])]
In [ ]:
df = df.sort_values(by='INT_TIME')
In [ ]:
plt.figure()
sns.pointplot(hue='COLLECTION_ID', y='mean', x='INT_TIME', data=df)
In [ ]:
%matplotlib inline
In [ ]:
df.columns
In [ ]:
to_drop = []
for col in df:
n_unique = len(df[col].unique())
if n_unique == 1:
print(col)
print(df[col].unique())
to_drop.append(col)
df = df.drop(to_drop, axis=1)
In [ ]:
df.INT_TIME.value_counts()/df.INT_TIME.size
In [ ]:
sns.lmplot(x='DET_TEMP', y='median', hue='CHANNEL',
col='INT_TIME', row='COLLECTION_ID', data=df, size=4)
In [ ]:
g = sns.FacetGrid(df, row='INT_TIME', hue='CHANNEL', size=1.7, aspect=4,)
g.map(sns.distplot, 'mean')
In [ ]:
df.BINNING_SET = df.BINNING_SET.astype('category')
In [ ]:
sns.jointplot(x='DET_TEMP',y='mean', data=df[(df.CHANNEL=='MUV') & (df.INT_TIME==14.4)])
In [ ]:
s = df.PRODUCT_ID.str.split('_')
s = s.map(lambda x: x[3]).str.split('-')
df['activity'] = s.map(lambda x: x[0])
In [ ]:
sns.lmplot(x='DET_TEMP', y='mean',hue='CHANNEL', data=df, aspect=1.33, size=8)
In [ ]:
ax = sns.lmplot(x='DET_TEMP', y='mean',hue='CHANNEL', data=df[df.INT_TIME==14.4],
aspect=1.33, size=6)
plt.gcf().tight_layout()
In [ ]:
df.groupby(['INT_TIME','BINNING_SET']).size()
In [ ]:
df.columns
In [ ]:
sns.set()
sns.pairplot(df['channel case_temp det_temp int_time solar_longitude'.upper().split() + ['mean']].dropna(),
hue='INT_TIME')
In [ ]:
In [ ]:
In [ ]:
In [ ]:
df[df['mean']>1.0].COLLECTION_ID.value_counts()
In [ ]:
df.COLLECTION_ID.value_counts()
In [ ]:
sns.set_context('talk')
In [ ]:
plt.figure()
ax = sns.stripplot(x='INT_TIME', y='mean', hue='CHANNEL', data=df.sort_values(by='INT_TIME'),
jitter=True)
ax.set_title("Dark mean vs INT_TIME")
In [ ]:
plt.figure()
ax = sns.boxplot(x='INT_TIME', y='mean', hue='CHANNEL', data=df.sort_values(by='INT_TIME'),
)
ax.set_title("Dark mean vs INT_TIME")
In [ ]:
plt.figure()
ax = sns.boxplot(x='INT_TIME', y='mean', hue='CHANNEL', data=df.sort_values(by='INT_TIME'),
)
ax.set_title("Dark mean vs INT_TIME")
In [ ]:
plt.figure()
ax = sns.violinplot(x='INT_TIME', y='mean', hue='CHANNEL', data=df.sort_values(by='INT_TIME'),
split=True, cut=0, scale='area')
ax.set_title("Dark mean vs INT_TIME")
In [ ]:
sns.violinplot?
In [ ]:
plt.figure()
ax = sns.violinplot(x='INT_TIME', y='mean', hue='CHANNEL', data=df.sort_values(by='INT_TIME'),
split=True, cut=0, scale='count')
sns.stripplot(x='INT_TIME', y='mean', hue='CHANNEL', data=df.sort_values(by='INT_TIME'),
jitter=True, size=4)
ax.set_title("Dark mean vs INT_TIME")
In [ ]:
sns.violinplot?
In [ ]:
plt.figure()
sns.distplot(df.loc[(df.INT_TIME==4.2) & (df['mean']<1), 'mean'].dropna())
In [ ]:
df.INT_TIME.value_counts()
In [ ]:
df[df.INT_TIME==14.4]['mean'].dropna().size
In [ ]:
plt.figure()
ax = sns.violinplot(x='INT_TIME', y='std', hue='CHANNEL', data=df.sort_values(by='INT_TIME'),
split=True, cut=0, scale='count', inner=None, bw=.2)
sns.stripplot(x='INT_TIME', y='std', hue='CHANNEL', data=df.sort_values(by='INT_TIME'),
jitter=False, alpha=0.7, size=4)
ax.set_title("Dark STD vs INT_TIME")
In [ ]:
plt.figure()
sns.barplot(x='INT_TIME', y='mean', hue='CHANNEL', data=df.sort_values(by='INT_TIME'))
In [ ]:
plt.figure()
ax = sns.countplot(x='INT_TIME', data=df.sort_values(by='INT_TIME'), palette='Greens_d',
hue='CHANNEL')
ax.set_title('Counts of integrations per INT_TIME')
In [ ]:
df = df[df.INT_TIME.isin([1.4, 4.2, 14.4])]
In [ ]:
g = sns.PairGrid(df, x_vars=['INT_TIME'], hue='CHANNEL',
y_vars=['mean','std'], size=3.5)
g.map(sns.violinplot)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
from iuvs import hk
In [ ]:
hkdb = pd.read_hdf('/home/klay6683/to_keep/HK_DB.h5', 'df')
In [ ]:
hkdb['2015'][['MUV_DET_TEMP_C']].resample('1min').plot()
In [ ]:
check_values('lya_centroid')
In [ ]:
df.sort_index(inplace=True)
In [ ]:
df.groupby(['CHANNEL', 'COLLECTION_ID','INT_TIME'])['median'].mean()
In [ ]:
%matplotlib nbagg
In [ ]:
df['mean'].max()
In [ ]:
df[df['mean']> 20].filter(regex='NAXIS.')
In [ ]:
In [ ]:
df[df['mean']> 20].PRODUCT_ID.values
In [ ]:
plt.figure()
df['mean'].plot(kind='hist', bins=100, logy=True, xlim=(0,3))
In [ ]:
l1a = io.L1AReader('mvn_iuv_l1a_apoapse-orbit01597-muvdark_20150725T184050_v02_r01.fits.gz',
env='production')
In [ ]:
l1a
In [ ]:
l1a.img.shape
In [ ]:
l1a.img.mean()
In [ ]:
l1a.p
In [ ]:
df.groupby(['activity','COLLECTION_ID'])['mean'].mean()
In [ ]:
cols_of_interest = df.columns.drop('anc_svn_revision bin_tbl code_svn_revision obs_id'
' orbit_number process product_id'.upper().split())
In [ ]:
# df.CHANNEL = df.CHANNEL.map(lambda x: 0 if x=='MUV' else 1)
In [ ]:
df=df[cols_of_interest]
# df = df.select_dtypes(include=[float, int])
# df= df.drop('SW_VER NAXIS3'.split(), axis=1)
In [ ]:
df = df.dropna(how='any')
In [ ]:
df.to_hdf('/Users/klay6683/data/iuvs/dark_stuff/to_study.h5','df')
In [ ]:
df.head()
In [ ]:
df['mirdeg_delta'] = df.MIRROR_DEG - df.MIR_DEG
In [ ]:
plt.figure()
df.mirdeg_delta.plot(style='.')
In [ ]: